// AverageFilter.cpp
// Dopplar Radar Milestone 1
// RCOS - Griffin Milsap and Sean Austin

#include "AverageFilter.h"

using namespace std;

AverageFilter::AverageFilter()
{
  // Construct
}

AverageFilter::~AverageFilter()
{
  // Deconstruct
}

bool AverageFilter::Initialize( const Signal &input )
{
  // Initialize the sliding average filter
  return true;
}

void AverageFilter::Process( const Signal &input, Signal &output )
{
  // Process the filter
  float avg = 0;
  for( Signal::const_iterator itr = input.begin(); itr != input.end(); itr++ )
    avg += itr->first;
  avg = avg / input.size();
  for( Signal::iterator itr = output.begin(); itr != output.end(); itr++ )
    itr->first = avg;
  output = input;
}
